<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "cms_catalog".
 *
 * @property integer $id
 * @property integer $parent_id
 * @property string $title
 * @property string $surname
 * @property string $brief
 * @property string $content
 * @property string $seo_title
 * @property string $seo_keywords
 * @property string $seo_description
 * @property string $banner
 * @property integer $is_nav
 * @property integer $sort_order
 * @property string $page_type
 * @property integer $page_size
 * @property string $template_list
 * @property string $template_show
 * @property string $template_page
 * @property string $redirect_url
 * @property integer $click
 * @property integer $status
 * @property integer $created_at
 * @property integer $updated_at
 *
 * @property CmsShow[] $cmsShows
 */
class CmsCatalog extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'cms_catalog';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['parent_id', 'is_nav', 'sort_order', 'page_size', 'click', 'status', 'created_at', 'updated_at'], 'integer'],
            [['title', 'created_at', 'updated_at'], 'required'],
            [['content'], 'string'],
            [['title', 'surname', 'seo_title', 'seo_keywords', 'seo_description', 'banner', 'page_type', 'template_list', 'template_show', 'template_page', 'redirect_url'], 'string', 'max' => 255],
            [['brief'], 'string', 'max' => 1022],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'parent_id' => 'Parent ID',
            'title' => 'Title',
            'surname' => 'Surname',
            'brief' => 'Brief',
            'content' => 'Content',
            'seo_title' => 'Seo Title',
            'seo_keywords' => 'Seo Keywords',
            'seo_description' => 'Seo Description',
            'banner' => 'Banner',
            'is_nav' => 'Is Nav',
            'sort_order' => 'Sort Order',
            'page_type' => 'Page Type',
            'page_size' => 'Page Size',
            'template_list' => 'Template List',
            'template_show' => 'Template Show',
            'template_page' => 'Template Page',
            'redirect_url' => 'Redirect Url',
            'click' => 'Click',
            'status' => 'Status',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCmsShows()
    {
        return $this->hasMany(CmsShow::className(), ['catalog_id' => 'id']);
    }
}
